package com.fancy.ui.ctrls.ease
{
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFormat;
	
	public class EsLabel extends Sprite
	{
		private var _tf:TextField = new TextField();
		
		private var _caption:String = "";
		public function set caption(value:String):void
		{
			_caption = value;
			render();
		}
		
		public function EsLabel(caption:String="未命名")
		{
			super();
			_caption = caption;
			init();
			render();
		}
		
		private function init():void
		{
			var fmt:TextFormat = new TextFormat();
			fmt.font = "华文新楷";
			fmt.size = 18;
			fmt.color = 0xff0000;
			_tf.defaultTextFormat = fmt;
			_tf.mouseEnabled = false;
			_tf.mouseWheelEnabled = false;
			addChild(_tf);
		}
		
		private function render():void
		{
			_tf.text = _caption;
			_tf.width = _tf.textWidth + 10;
			_tf.height = _tf.textHeight + 4;
		}
		
	}
}